package edu.yourl.presenter;

import edu.yourl.domain.User;
import edu.yourl.persistence.IUserRepository;
import edu.yourl.web.IRegistrationPage;

public class RegistrationPresenter implements IRegistrationPresenter {

	private IUserRepository repository;
	
	@Override
	public void registerUser(IRegistrationPage page) {
		User user = new User(page.getName(),page.getEmail(),page.getPassword(), page.getNickname());
		this.repository.addUser(user);
		page.getYourlSession().setUser(user);
	}
	
	public void setRepository(IUserRepository repository) {
		this.repository = repository;
	}

}
